package com.luoying.itew.adapter;

import android.content.Context;
import androidx.recyclerview.widget.RecyclerView;
import android.view.View;
import android.view.ViewGroup;

import com.luoying.itew.bean.InspectLogBean;
import com.luoying.itew.view.InspectLogItemView;

import java.util.List;

/**
 * Created by Administrator on 2018/5/25.
 * time 2018-5-10
 * author zm
 */
public class InspectLogAdapter  extends RecyclerView.Adapter{
    private Context mContext;
    private List<InspectLogBean.PaginationBean.RecordsBean> mList;
    public InspectLogAdapter(Context context, List<InspectLogBean.PaginationBean.RecordsBean> records) {
        this.mContext = context;
        this.mList = records;
    }

    @Override
    public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {

        InspectLogItemView noticeItemView = new InspectLogItemView(mContext);
        InspectLogViewHolder viewHolder = new InspectLogViewHolder(noticeItemView);
        return viewHolder;


    }

    @Override
    public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {

        InspectLogItemView itemView = (InspectLogItemView) holder.itemView;
        itemView.setData(mList.get(position));


    }

    @Override
    public int getItemCount() {
        return mList.size();
    }



    public void addList(List<InspectLogBean.PaginationBean.RecordsBean>  news) {
        mList.addAll(news);
        notifyDataSetChanged();
    }



    static class InspectLogViewHolder extends RecyclerView.ViewHolder {
        public InspectLogViewHolder(View itemView) {
            super(itemView);
        }
    }
}
